home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 117 / MacAddict 117.dmg / Software / Productivity / NoteBook 2.3.3 (demo).dmg / NoteBook.app / Contents / Resources / notebook.js < prev    next >
Encoding:
Text File  |  2005-08-01  |  4.9 KB  |  159 lines

  1. <!--
  2. // notebook.js
  3. //
  4. //
  5. // Unless otherwise licensed, the source code in this file ("the Software") is provided
  6. // under the terms of this LICENSE.
  7. //
  8. // Copyright © 2003 Circus Ponies Software, Inc. All Rights Reserved.
  9. //
  10. // Circus Ponies Software, Inc. ("Circus Ponies") gives you limited permission to
  11. // redistribute the Software provided that all of the following conditions are met:
  12. //
  13. // 1. Redistribution must retain the above copyright notice plus this list of
  14. //    conditions and disclaimers in its entirety.
  15. //
  16. // 2. You may not distribute a modified version of the Software.
  17. //
  18. // 3. You may not charge a fee for the Software or claim that the Software is yours.
  19. //
  20. // 4. You may not use the names Circus Ponies, Circus Ponies NoteBook, or Circus Ponies
  21. //    Software, Inc. to endorse or promote products derived from the Software without
  22. //    the prior written permission of Circus Ponies.
  23. //
  24. // 5. This Software is provided "AS IS," without a warranty of any kind.  ALL EXPRESS
  25. //    OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED
  26. //    WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-
  27. //    INFRINGEMENT, ARE HEREBY EXCLUDED. CIRCUS PONIES AND ITS LICENSORS SHALL NOT BE
  28. //    LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  29. //    DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL CIRCUS PONIES OR
  30. //    ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
  31. //    INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED
  32. //    AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY
  33. //    TO USE THIS SOFTWARE, EVEN IF CIRCUS PONIES HAS BEEN ADVISED OF THE POSSIBILITY
  34. //    OF SUCH DAMAGES.
  35. //
  36. // 6. You acknowledge that this software is not designed, licensed or intended for use
  37. //    in the design, construction, operation, or maintenance of any nuclear facility.
  38. //
  39. //
  40. // Version: 12-Sep-03    03:03 pm
  41. //
  42. //
  43.  
  44.  
  45. // Global Variables
  46. var notebookPageInitFunctions = new Array();
  47. var notebookPageInitFunctionCount = 0;
  48.  
  49.  
  50. function SwapImage( image, newImageSrc ) 
  51. {
  52.  if (document.images) {
  53.     eval("document."+image+".src = newImageSrc;");
  54.  }
  55.     
  56. }
  57.  
  58.  
  59. function AddNotebookPageInitFunction( theFunction ) {
  60.     notebookPageInitFunctions[notebookPageInitFunctionCount++] = theFunction;
  61. }
  62.  
  63.  
  64. function InitNotebookPage() {
  65.     
  66.     // Just execute all the Init Functions
  67.     for(var i=0; i<notebookPageInitFunctionCount; i++) {
  68.     
  69.         eval( notebookPageInitFunctions[i] );
  70.     }
  71. }
  72.  
  73.  
  74. function DoControlAnimation( theControlImageID, expand, image1, image2, image3, image4, iteration ) {
  75.        
  76.     // Swap the Image to the next in the animation
  77.     if (iteration == 1) {
  78.         SwapImage( theControlImageID, image1 );
  79.     }
  80.     else if (iteration == 2) {
  81.         SwapImage( theControlImageID, image2 );
  82.     }
  83.     else if (iteration == 3) {
  84.         SwapImage( theControlImageID, image3 );
  85.     }
  86.     else if (iteration == 4) {
  87.         SwapImage( theControlImageID, image4 );
  88.     }
  89.     
  90.     // set up for the next iteration
  91.     if ((iteration < 4) && (iteration > 0)) { 
  92.         
  93.         var nextIteration;
  94.         if (expand) {
  95.             nextIteration = iteration+1;
  96.         }
  97.         else {
  98.             nextIteration = iteration-1;
  99.         }
  100.         
  101.         // Call recursively with a delay of 20 ms
  102.         setTimeout("DoControlAnimation('" +theControlImageID+ "'," +expand+ ",'" +image1+ "','" +image2+ "','" +image3+ "','" +image4+ "'," +nextIteration+ ");", 20);        }
  103. }
  104.  
  105. function ExpandNotebookCell( theObjectID, theControlImageID, image1, image2, image3, image4 ) {
  106.         
  107.     var theLayer = null;
  108.     if (document.getElementById) {
  109.     
  110.          // Level 1 DOM code
  111.         theLayer = document.getElementById( theObjectID ).style;
  112.          if (theLayer) {
  113.                 
  114.             if (theLayer.display=='none') {
  115.                  theLayer.display = '';
  116.                 DoControlAnimation( theControlImageID, true, image1, image2, image3, image4, 2); // expand animation
  117.             }
  118.             else {
  119.                  theLayer.display = 'none';
  120.                 DoControlAnimation( theControlImageID, false, image1, image2, image3, image4, 3); // collapse animation
  121.             }
  122.         }
  123.     }
  124.     else if (document.all) {
  125.     
  126.         // Microsoft DOM code
  127.         theLayer = eval("document.all." +theObjectID+ ".style" );
  128.         if (theLayer) {
  129.             if (theLayer.display=='none') {
  130.                 theLayer.display = '';
  131.                 DoControlAnimation( theControlImageID, true, image1, image2, image3, image4, 2); // expand animation
  132.             }
  133.             else {
  134.                 theLayer.display = 'none';
  135.                 DoControlAnimation( theControlImageID, false, image1, image2, image3, image4, 3); // collapse animation
  136.             }
  137.         }
  138.     }
  139.     else if (document.layers) {
  140.     
  141.         // Netscape DOM code
  142.         theLayer = document.layers[ theObjectID ];
  143.         
  144.         if (theLayer) {
  145.             if ( theLayer.visibility == 'hide' ) {
  146.                 theLayer.visibility = 'show';
  147.                 DoControlAnimation( theControlImageID, true, image1, image2, image3, image4, 2); // expand animation
  148.             }
  149.             else {
  150.                 theLayer.visibility = 'hide';
  151.                 DoControlAnimation( theControlImageID, false, image1, image2, image3, image4, 3); // collapse animation
  152.             }
  153.         }
  154.     }
  155. }
  156.  
  157.  
  158.  
  159. //-->